/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.ugc.cnel.manabi.entidades;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Admin
 */
@Entity
@Table(name = "inspector", catalog = "", schema = "public")
@NamedQueries({@NamedQuery(name = "Inspector.findAll", query = "SELECT i FROM Inspector i"), @NamedQuery(name = "Inspector.findById", query = "SELECT i FROM Inspector i WHERE i.id = :id"), @NamedQuery(name = "Inspector.findByNombres", query = "SELECT i FROM Inspector i WHERE i.nombres = :nombres"), @NamedQuery(name = "Inspector.findByApellidos", query = "SELECT i FROM Inspector i WHERE i.apellidos = :apellidos"), @NamedQuery(name = "Inspector.findByEstado", query = "SELECT i FROM Inspector i WHERE i.estado = :estado"), @NamedQuery(name = "Inspector.findByTelefono", query = "SELECT i FROM Inspector i WHERE i.telefono = :telefono"), @NamedQuery(name = "Inspector.findByCorreo", query = "SELECT i FROM Inspector i WHERE i.correo = :correo")})
public class Inspector implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy=GenerationType.SEQUENCE)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "nombres", nullable = false, length = 50)
    private String nombres;
    @Basic(optional = false)
    @Column(name = "apellidos", nullable = false, length = 50)
    private String apellidos;
    @Basic(optional = false)
    @Column(name = "estado", nullable = false)
    private boolean estado;
    @Column(name = "telefono")
    private BigInteger telefono;
    @Column(name = "correo", length = 150)
    private String correo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idInspector")
    private Collection<Inspeccion> inspeccionCollection;

    public Inspector() {
    }

    public Inspector(Integer id) {
        this.id = id;
    }

    public Inspector(Integer id, String nombres, String apellidos, boolean estado) {
        this.id = id;
        this.nombres = nombres;
        this.apellidos = apellidos;
        this.estado = estado;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombres() {
        return nombres;
    }

    public void setNombres(String nombres) {
        this.nombres = nombres;
    }

    public String getApellidos() {
        return apellidos;
    }

    public void setApellidos(String apellidos) {
        this.apellidos = apellidos;
    }

    public boolean getEstado() {
        return estado;
    }

    public void setEstado(boolean estado) {
        this.estado = estado;
    }

    public BigInteger getTelefono() {
        return telefono;
    }

    public void setTelefono(BigInteger telefono) {
        this.telefono = telefono;
    }

    public String getCorreo() {
        return correo;
    }

    public void setCorreo(String correo) {
        this.correo = correo;
    }

    public Collection<Inspeccion> getInspeccionCollection() {
        return inspeccionCollection;
    }

    public void setInspeccionCollection(Collection<Inspeccion> inspeccionCollection) {
        this.inspeccionCollection = inspeccionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {

        if (!(object instanceof Inspector)) {
            return false;
        }
        Inspector other = (Inspector) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        //return "org.ugc.cnel.manabi.entidades.Inspector[id=" + id + "]";
        return apellidos +" " +nombres;
    }

}
